﻿using System;
using System.Linq;
using EzDesk.Apps.Model.Message;

namespace EzDesk.Apps.ServiceImpl.Message
{
    public static class TopicExt
    {
        public static bool? HasConfirmedBy(this Topic topic,Guid recipientId)
        {
            bool? result = null;
            // 需要确认 并且接受的不是自己的消息，则判断是否确认过
            if (topic.NeedConfirm && (recipientId != topic.SenderId))
            {
                result = topic.MessageInbox.Any(confirm => confirm.UserId == recipientId && confirm.ConfirmOn!=null);
            }
            return result;
        }

        //public static List<Guid> GetNoConfirmUsers(this Topic topic)
        //{
        //}

        //public static List<Guid> GetNoConfirmUsers(this Topic topic)
        //{
        //}


    }
}
